package copy;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

//使用字符流,字符数组读写
public class CopyFileWithCharStreamArray {
    public static void main(String[] args)
    {
        try(FileReader fr = new FileReader("src/main/source.txt");
            FileWriter fw = new FileWriter("src/main/destination4.txt")){
            char[] buffer = new char[1024];
            int length;
            while((length = fr.read(buffer))!=-1)
            {
                fw.write(buffer,0,length);
            }
        }catch (IOException e)
        {
           e.printStackTrace();
        }
    }
}
